In cellular communication, user equipment first sends data to a base station by using an air interface, and then the base station forwards the data to a target node on a network. A difference between device-to-device (D2D) communication and existing cellular communication is that data of user equipment is directly sent to another user equipment by using an air interface without being forwarded by a base station, to reduce a delay caused by forwarding on a network. Currently, D2D supports unicast communication. That is, user equipment can directly send data to another user equipment. D2D also supports multicast communication. That is, user equipment can directly send data to multiple other user equipments in a communication group. In addition, in device-to-device D2D communication, data sent by user equipment has multiple priorities. Data of different types have different priorities. For example, a priority of voice data may be higher than that of regular file transmission data.
In an existing technical solution, a D2D data transmission link supports that user equipment serving as a relay node helps another device perform cellular network communication. As shown in FIG. 1, a second device may send data to a base station by using a first device, and the base station may also send data to the second device by using the first device. A first link between the first device and the base station and a second link between the second device and the first device each have multiple logical channels, and each of the logical channels can correspondingly transmit data having one priority. However, after the base station sends data having multiple priorities to the first device by using multiple logical channels on the first link, the first device maps the data having different priorities onto a same logical channel on the second link to transmit the data to the second device. Consequently, data having a higher priority cannot be preferably processed, affecting the data processing efficiency.